<template>
  <div id="app">
      <header>
        <span>返回</span>
        <input type="text">
      </header>
      <main>
        <TabTitle :list="list" :activeIndex="activeIndex"></TabTitle>
        <TabMain :children="list[activeIndex].children"></TabMain>
      </main>
  </div>
</template>

<script>
import TabTitle from "./components/TabTitle.vue";
import TabMain from './components/TabMain.vue';
import Mock from "mockjs";

const data=Mock.mock({
  "list|10":[{
    title:"@ctitle(3)",
    "children|15":[
      {
        img:"@image(70X70,@color)",
        name:"@cname",
      }
    ]
  }]
})


export default {
  name: 'App',
  components: {
    TabTitle,
    TabMain
  },
  data()
  {
    return{
        list:data.list,
        activeIndex:0
    }
  },
  mounted(){
    this.bus.$on("changeActive",(index)=>
    {
      console.log("打电话");
      this.activeIndex=index;
    })
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
  display: flex;
  flex-direction: column;
}
header{
  margin-top: -50px;
  margin-bottom: 20px;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
}
main{
  flex:1;
}
</style>
